Skip to content

Python: Include InvokeAzureAgent input.arguments in agent text - #7907

Draft
Shivani . (Shivani767) wants to merge 1 commit into
microsoft:mainfrom
Shivani767:fix/7902-invoke-azure-agent-arguments
Draft

Python: Include InvokeAzureAgent input.arguments in agent text#7907
Shivani . (Shivani767) wants to merge 1 commit into
microsoft:mainfrom
Shivani767:fix/7902-invoke-azure-agent-arguments

Conversation

@Shivani767

@Shivani767 Shivani . (Shivani767) commented Aug 27, 2026

Copy link
Copy Markdown

Motivation & Context

InvokeAzureAgentExecutor._build_input_text() evaluated input.arguments into evaluated_args and then never used that dict. Actions that supply only input.arguments (as in the customer_support sample) therefore invoked the agent with an empty string.

Fixes #7902

Description & Review Guide

  • What are the major changes?

    • Format evaluated input.arguments as key: value lines (same shape as multi-value Workflow.Inputs fallback).
    • Include that text in the agent input, alone or combined with explicit messages / fallback input.
    • Add regression tests for arguments-only, arguments+messages, and expression-valued arguments.
  • What is the impact of these changes?

    • Argument-only InvokeAzureAgent actions now pass structured values to agent.run().
    • Existing messages-only and fallback-input behavior is unchanged when no arguments are present.
  • What do you want reviewers to focus on?

    • Whether folding arguments into text is the right Python parity approach vs. a Foundry structured_inputs channel (.NET uses the latter; Python run() has no equivalent parameter).

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Fold evaluated input.arguments into the text passed to agent.run() so
argument-only InvokeAzureAgent actions no longer silently invoke with
an empty string.
Copilot AI balanced review requested due to automatic review settings August 27, 2026 10:25
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Aug 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes #7902 by preserving evaluated InvokeAzureAgent arguments in agent input text.

Changes:

  • Formats arguments as key: value lines.
  • Combines arguments with explicit or fallback message text.
  • Adds regression coverage for argument-only, combined, and expression-based inputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/packages/declarative/agent_framework_declarative/_workflows/_executors_agents.py Includes evaluated arguments in agent input text.
python/packages/declarative/tests/test_graph_coverage.py Adds regression tests for argument handling.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@moonbox3 Evan Mattson (moonbox3) added the declarative Usage: [Issues, PRs], Target: declarative agents and workflows label Aug 31, 2026
@moonbox3

Copy link
Copy Markdown
Contributor

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 88e4989182d7
Model: gpt-5.6-sol

Overview

The change correctly recovers previously discarded input.arguments, evaluates expressions before formatting, and preserves the existing messages-only behavior when the argument map is empty. The new tests cover arguments alone on a clean state, arguments with explicit messages, and expression-valued arguments. However, arguments-only actions still execute the implicit-input fallback chain, so chained workflows append a prior agent response or workflow input to the explicit argument block.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/packages/declarative/agent_framework_declarative/_workflows/_executors_agents.py

messages_text = str(getattr(last, "text", "")) # type: ignore
elif evaluated_input:
messages_text = str(cast(Any, evaluated_input))
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When an action supplies input.arguments but omits input.messages, this branch still reads the implicit fallback chain and line 741 appends it to the argument block. In a chained workflow, every completed agent sets System.LastMessage, so arguments-only actions such as the customer-support TicketingAgent receive both their structured fields and the prior agent's response; first-agent actions can similarly duplicate values from Workflow.Inputs. Please skip the implicit fallback when explicit arguments are present, while retaining it for actions with neither arguments nor messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

declarative Usage: [Issues, PRs], Target: declarative agents and workflows python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Python: [Bug]: InvokeAzureAgent silently drops input.arguments, never sends them to the agent

4 participants